<?php
/**
 * Created by PhpStorm.
 * User: albert
 * Date: 17-12-27
 * Time: 下午4:45
 */

namespace services\user\models;

use yii\behaviors\TimestampBehavior;

class User extends Users
{
    /**
     * Finds user by username
     *
     * @param string $username
     * @return static|null
     */
    public static function findByUsername($username)
    {
        return static::findOne(['username' => $username]);
    }

    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::class,
            ]
        ];
    }

    public $sceneList = [
        'index' => 'defaultIndex'
    ];

    public function defaultIndex($filter)
    {
        $filter['select'] = ['id'];
        return [self::ACTION_NEXT, $filter];
    }
}